﻿@using nwrole.lib
@model IEnumerable<nwrole.lib.SupervisorInfo>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Registered Supervisors</h2>

@*<p>
    @Html.ActionLink("Create New", "Create")
</p>*@
<table>
    <tr>
        <th>Name</th>
        <th>Status</th>
        <th>Last registered</th>
        <th>Last seen</th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.DisplayName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Status)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.LastRegistered)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.LastSeen)
        </td>
        <td>
            @Html.ActionLink("Details", "Details", new { id=item.Id }) 
            @Html.ActionLink("Log", "Show", "Log", new { id=item.Id }, null) 
            @if(item.Status == SupervisorStatus.Connected)
            {
                @: | 
                @Html.ActionLink("Restart", "RestartSupervisor", new { id = item.Id }) 
            }
        </td>
    </tr>
}

</table>
